<div class="col-lg-10">
	<h1>Редактирование товара</h1>
	<hr>
	<?php 
	if (isset($_GET['del_g'])) delete_goods($_GET['del_g']);
	if (isset($_GET['edit_g'])) {
		$edit_data = get_goods($_GET['edit_g']);
		include 'includes/edit.php';
	}
 	?>
	<table class="table">
		<tr>
			<th>Категория товара</th>
			<th>Имя товара</th>
			<th>Цена товара</th>
			<th>Дата добавления</th>
			<th>-</th>
			<th>-</th>
		</tr>
		<?php
			$data = get_goods();
			foreach ($data as $key => $value) {
				?>
				<tr>
					<td><?=$value['cat_name']?></td>
					<td><?=$value['name']?></td>
					<td><?=$value['price']?></td>
					<td><?=$value['goods_date']?></td>
					<td>
						<a href="<?=$_SERVER['PHP_SELF']?>?p=edit_goods&edit_g=<?=$value['id_goods']?>" class="btn btn-success">Редактировать</a>
					</td>
					<td>
						<a href="<?=$_SERVER['PHP_SELF']?>?p=edit_goods&del_g=<?=$value['id_goods']?>" class="btn btn-warning">Удалить</a>
					</td>
				</tr>
				<?php
			}
		?>
	</table>
</div>